package com.simple.behavior.classstatus.memento;

import com.simple.LogUtil;

/**
 * @author simple
 * @version 1.0
 * @date 2019-01-04 18:25
 * @since 1.0
 */
public class Start {
    public static void main(String[] args) {
        Original original = new Original("egg");
        Storage storage = new Storage(original.createMemento());
        // 修改原始类的状态
        LogUtil.info("初始化状态为: " + original.getValue());
        original.setValue("niu");
        LogUtil.info("修改后状态为: " + original.getValue());
        // 回复原始类的状态
        original.restoreMemento(storage.getMemento());
        LogUtil.info("恢复后的状态: " + original.getValue());
    }
}
